//
//  RYCGeometry.c
//  RaiyiCommon
//
//  Created by zhiwei ma on 12-4-26.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "RYCGeometry.h"

CGSize scaleSize(CGSize aSrcSize,CGSize aDstSize)
{
    CGSize newsize;
    if(aSrcSize.width<aDstSize.width && aSrcSize.height < aDstSize.height)
    {
        newsize = aSrcSize;
    }
    else 
    {
        if(aSrcSize.width/aDstSize.width - aSrcSize.height/aDstSize.height >= 0.000001)
        {
            newsize.width = aDstSize.width;
            newsize.height = aSrcSize.height*aDstSize.width/aSrcSize.width;
        }
        else 
        {
            newsize.height = aDstSize.height;
            newsize.width = aSrcSize.width*aDstSize.height/aSrcSize.height;
        }
    }
    return newsize;
}